<template>
  <XMTitle title="Games" />
  <XMListCard
    :gameJson="homeGameJson"
    openBig
  />
  <XMFooter :isShowBackToTop="false" />
  <XMListCard :gameJson="randomGameJson" />
  <XMTitle title="Game Categories" />
  <XMCategory showMore />
</template>

<script lang="ts" setup>
import { useGA } from "~/composables/useGA";

const { trackEvent } = useGA();
const { hostName } = useConfigStore();
/** 获取随机游戏数据24个 */
const { data: randomGameJson } = await useFetch<GameJson[]>("/api/getRandomGame", {
  method: "POST",
  body: { hostName },
});
/** 获取首页120个游戏 */
const { data: homeGameJson } = await useFetch<GameJson[]>("/api/getHomeGame", {
  method: "POST",
  body: { hostName },
});

trackEvent({
  eventName: "Home_Page_Show",
});
</script>

<style scoped></style>
